<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for ./src/ocLazyLoad.loaders.common.js</title>
    <meta charset="utf-8">

    <link rel="stylesheet" href="../prettify.css">

    <link rel="stylesheet" href="../base.css">
    <style type='text/css'>
        div.coverage-summary .sorter {
            background-image: url(../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class="header medium">
    <h1>Code coverage report for <span class="entity">./src/ocLazyLoad.loaders.common.js</span></h1>
    <h2>
        
        Statements: <span class="metric">67.16% <small>(45 / 67)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">53.06% <small>(26 / 49)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">87.5% <small>(7 / 8)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">68.18% <small>(45 / 66)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
    </h2>
    <div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">./src\</a> &#187; ocLazyLoad.loaders.common.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">26</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-yes">12</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
&nbsp;
(function (angular) {
    "use strict";
&nbsp;
    angular.module("oc.lazyLoad").config(function ($provide) {
        $provide.decorator("$ocLazyLoad", function ($delegate, $q, $window, $interval) {
            var uaCssChecked = false,
                useCssLoadPatch = false,
                anchor = $window.document.getElementsByTagName("head")[0] || <span class="branch-1 cbranch-no" title="branch not covered" >$window.document.getElementsByTagName("body")[0];</span>
&nbsp;
            /**
             * Load a js/css file
             * @param type
             * @param path
             * @param params
             * @returns promise
             */
            $delegate.buildElement = function buildElement(type, path, params) {
                var deferred = $q.defer(),
                    el,
                    loaded,
                    filesCache = $delegate._getFilesCache(),
                    cacheBuster = function cacheBuster(url) {
                    var dc = new Date().getTime();
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (url.indexOf("?") &gt;= 0) {
<span class="cstat-no" title="statement not covered" >                        if (url.substring(0, url.length - 1) === "&amp;") {</span>
<span class="cstat-no" title="statement not covered" >                            return "" + url + "_dc=" + dc;</span>
                        }
<span class="cstat-no" title="statement not covered" >                        return "" + url + "&amp;_dc=" + dc;</span>
                    } else {
                        return "" + url + "?_dc=" + dc;
                    }
                };
&nbsp;
                // Store the promise early so the file load can be detected by other parallel lazy loads
                // (ie: multiple routes on one page) a 'true' value isn't sufficient
                // as it causes false positive load results.
                <span class="missing-if-branch" title="else path not taken" >E</span>if (angular.isUndefined(filesCache.get(path))) {
                    filesCache.put(path, deferred.promise);
                }
&nbsp;
                // Switch in case more content types are added later
                switch (type) {
                    case "css":
                        el = $window.document.createElement("link");
                        el.type = "text/css";
                        el.rel = "stylesheet";
                        el.href = params.cache === false ? <span class="branch-0 cbranch-no" title="branch not covered" >cacheBuster(path) </span>: path;
                        break;
                    case "js":
                        el = $window.document.createElement("script");
                        el.src = params.cache === false ? cacheBuster(path) : path;
                        break;
<span class="branch-2 cbranch-no" title="branch not covered" >                    default:</span>
<span class="cstat-no" title="statement not covered" >                        filesCache.remove(path);</span>
<span class="cstat-no" title="statement not covered" >                        deferred.reject(new Error("Requested type \"" + type + "\" is not known. Could not inject \"" + path + "\""));</span>
<span class="cstat-no" title="statement not covered" >                        break;</span>
                }
                el.onload = el.onreadystatechange = function (e) {
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (el.readyState &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >!/^c|loade/.test(el.readyState) </span>|| loaded) <span class="cstat-no" title="statement not covered" >return;</span>
                    el.onload = el.onreadystatechange = null;
                    loaded = 1;
                    $delegate._broadcast("ocLazyLoad.fileLoaded", path);
                    deferred.resolve();
                };
                el.onerror = function () {
                    filesCache.remove(path);
                    deferred.reject(new Error("Unable to load " + path));
                };
                el.async = params.serie ? 0 : 1;
&nbsp;
                var insertBeforeElem = anchor.lastChild;
                if (params.insertBefore) {
                    var element = angular.element(angular.isDefined(window.jQuery) ? <span class="branch-0 cbranch-no" title="branch not covered" >params.insertBefore </span>: document.querySelector(params.insertBefore));
                    <span class="missing-if-branch" title="else path not taken" >E</span>if (element &amp;&amp; element.length &gt; 0) {
                        insertBeforeElem = element[0];
                    }
                }
                insertBeforeElem.parentNode.insertBefore(el, insertBeforeElem);
&nbsp;
                /*
                 The event load or readystatechange doesn't fire in:
                 - iOS &lt; 6       (default mobile browser)
                 - Android &lt; 4.4 (default mobile browser)
                 - Safari &lt; 6    (desktop browser)
                 */
                if (type == "css") {
                    <span class="missing-if-branch" title="else path not taken" >E</span>if (!uaCssChecked) {
                        var ua = $window.navigator.userAgent.toLowerCase();
&nbsp;
                        // iOS &lt; 6
                        <span class="missing-if-branch" title="if path not taken" >I</span>if (/iP(hone|od|ad)/.test($window.navigator.platform)) {
<span class="cstat-no" title="statement not covered" >                            var v = $window.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);</span>
<span class="cstat-no" title="statement not covered" >                            var iOSVersion = parseFloat([parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)].join("."));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = iOSVersion &lt; 6;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("android") &gt; -1) {
                            // Android &lt; 4.4
<span class="cstat-no" title="statement not covered" >                            var androidVersion = parseFloat(ua.slice(ua.indexOf("android") + 8));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = androidVersion &lt; 4.4;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("safari") &gt; -1) {
<span class="cstat-no" title="statement not covered" >                            var versionMatch = ua.match(/version\/([\.\d]+)/i);</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = versionMatch &amp;&amp; versionMatch[1] &amp;&amp; parseFloat(versionMatch[1]) &lt; 6;</span>
                        }
                    }
&nbsp;
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (useCssLoadPatch) {
<span class="cstat-no" title="statement not covered" >                        var tries = 1000; </span>// * 20 = 20000 miliseconds
<span class="cstat-no" title="statement not covered" >                        var interval = $interval(<span class="fstat-no" title="function not covered" >function () {</span></span>
<span class="cstat-no" title="statement not covered" >                            try {</span>
<span class="cstat-no" title="statement not covered" >                                el.sheet.cssRules;</span>
<span class="cstat-no" title="statement not covered" >                                $interval.cancel(interval);</span>
<span class="cstat-no" title="statement not covered" >                                el.onload();</span>
                            } catch (e) {
<span class="cstat-no" title="statement not covered" >                                if (--tries &lt;= 0) {</span>
<span class="cstat-no" title="statement not covered" >                                    el.onerror();</span>
                                }
                            }
                        }, 20);
                    }
                }
&nbsp;
                return deferred.promise;
            };
&nbsp;
            return $delegate;
        });
    });
})(angular);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkM6L3dhbXAvd3d3L29jTGF6eUxvYWQvc3JjL29jTGF6eUxvYWQubG9hZGVycy5jb21tb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxDQUFDLFVBQUEsT0FBTyxFQUFJO0FBQ1IsZ0JBQVksQ0FBQzs7QUFFYixXQUFPLENBQUMsTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxVQUFBLFFBQVEsRUFBSTtBQUM3QyxnQkFBUSxDQUFDLFNBQVMsQ0FBQyxhQUFhLEVBQUUsVUFBUyxTQUFTLEVBQUUsRUFBRSxFQUFFLE9BQU8sRUFBRSxTQUFTLEVBQUU7QUFDMUUsZ0JBQUksWUFBWSxHQUFHLEtBQUs7Z0JBQ3BCLGV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lZmVycmVkID0gJHEuZGVmZXIoKSxcclxuICAgICAgICAgICAgICAgICAgICBlbCxcclxuICAgICAgICAgICAgICAgICAgICBsb2FkZWQsXHJcbiAgICAgICAgICAgICAgICAgICAgZmlsZXNDYWNoZSA9ICRkZWxlZ2F0ZS5fZ2V0RmlsZXNDYWNoZSgpLFxyXG4gICAgICAgICAgICAgICAgICAgIGNhY2hlQnVzdGVyID0gZnVuY3Rpb24gY2FjaGVCdXN0ZXIodXJsKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkYyA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZih1cmwuaW5kZXhPZignPycpID49IDApIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKHVybC5zdWJzdHJpbmcoMCwgdXJsLmxlbmd0aCAtIDEpID09PSAnJicpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCR7IHVybCB9X2RjPSR7IGRjIH1gO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGAkeyB1cmwgfSZfZGM9JHsgZGMgfWA7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCR7IHVybCB9P19kYz0keyBkYyB9YDtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH07XHJcblxyXG4gICAgICAgICAgICAgICAgLy8gU3RvcmUgdGhlIHByb21pc2UgZWFybHkgc28gdGhlIGZpbGUgbG9hZCBjYW4gYmUgZGV0ZWN0ZWQgYnkgb3RoZXIgcGFyYWxsZWwgbGF6eSBsb2Fkc1xyXG4gICAgICAgICAgICAgICAgLy8gKGllOiBtdWx0aXBsZSByb3V0ZXMgb24gb25lIHBhZ2UpIGEgJ3RydWUnIHZhbHVlIGlzbid0IHN1ZmZpY2llbnRcclxuICAgICAgICAgICAgICAgIC8vIGFzIGl0IGNhdXNlcyBmYWxzZSBwb3NpdGl2ZSBsb2FkIHJlc3VsdHMuXHJcbiAgICAgICAgICAgICAgICBpZihhbmd1bGFyLmlzVW5kZWZpbmVkKGZpbGVzQ2FjaGUuZ2V0KHBhdGgpKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZpbGVzQ2FjaGUucHV0KHBhdGgsIGRlZmVycmVkLnByb21pc2UpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIC8vIFN3aXRjaCBpbiBjYXNlIG1vcmUgY29udGVudCB0eXBlcyBhcmUgYWRkZWQgbGF0ZXJcclxuICAgICAgICAgICAgICAgIHN3aXRjaCh0eXBlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAnY3NzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgZWwgPSAkd2luZG93LmRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2xpbmsnKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZWwudHlwZSA9ICd0ZXh0L2Nzcyc7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsLnJlbCA9ICdzdHlsZXNoZWV0JztcclxuICAgICAgICAgICAgICAgICAgICAgICAgZWwuaHJlZiA9IHBhcmFtcy5jYWNoZSA9PT0gZmFsc2UgPyBjYWNoZUJ1c3RlcihwYXRoKSA6IHBhdGg7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xyXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2pzJzpcclxuICAgICAgICAgICAgICAgICAgICAgICAgZWwgPSAkd2luZG93LmRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5zcmMgPSBwYXJhbXMuY2FjaGUgPT09IGZhbHNlID8gY2FjaGVCdXN0ZXIocGF0aCkgOiBwYXRoO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxyXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlc0NhY2hlLnJlbW92ZShwYXRoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVqZWN0KG5ldyBFcnJvcihgUmVxdWVzdGVkIHR5cGUgXCIkeyB0eXBlIH1cIiBpcyBub3Qga25vd24uIENvdWxkIG5vdCBpbmplY3QgXCIkeyBwYXRoIH1cImApKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBlbC5vbmxvYWQgPSBlbFsnb25yZWFkeXN0YXRlY2hhbmdlJ10gPSBmdW5jdGlvbihlKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYoKGVsWydyZWFkeVN0YXRlJ10gJiYgIS9eY3xsb2FkZS8udGVzdChlbFsncmVhZHlTdGF0ZSddKSkgfHwgbG9hZGVkKSByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgZWwub25sb2FkID0gZWxbJ29ucmVhZHlzdGF0ZWNoYW5nZSddID0gbnVsbDtcclxuICAgICAgICAgICAgICAgICAgICBsb2FkZWQgPSAxO1xyXG4gICAgICAgICAgICAgICAgICAgICRkZWxlZ2F0ZS5fYnJvYWRjYXN0KCdvY0xhenlMb2FkLmZpbGVMb2FkZWQnLCBwYXRoKTtcclxuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKCk7XHJcbiAgICAgICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAgICAgZWwub25lcnJvciA9IGZ1bmN0aW9uKCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGZpbGVzQ2FjaGUucmVtb3ZlKHBhdGgpO1xyXG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoYFVuYWJsZSB0byBsb2FkICR7IHBhdGggfWApKTtcclxuICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICBlbC5hc3luYyA9IHBhcmFtcy5zZXJpZSA/IDAgOiAxO1xyXG5cclxuICAgICAgICAgICAgICAgIHZhciBpbnNlcnRCZWZvcmVFbGVtID0gYW5jaG9yLmxhc3RDaGlsZDtcclxuICAgICAgICAgICAgICAgIGlmKHBhcmFtcy5pbnNlcnRCZWZvcmUpIHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGFuZ3VsYXIuZWxlbWVudChhbmd1bGFyLmlzRGVmaW5lZCh3aW5kb3cualF1ZXJ5KSA/IHBhcmFtcy5pbnNlcnRCZWZvcmUgOiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHBhcmFtcy5pbnNlcnRCZWZvcmUpKTtcclxuICAgICAgICAgICAgICAgICAgICBpZihlbGVtZW50ICYmIGVsZW1lbnQubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBpbnNlcnRCZWZvcmVFbGVtID0gZWxlbWVudFswXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICBpbnNlcnRCZWZvcmVFbGVtLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGVsLCBpbnNlcnRCZWZvcmVFbGVtKTtcclxuXHJcbiAgICAgICAgICAgICAgICAvKlxyXG4gICAgICAgICAgICAgICAgIFRoZSBldmVudCBsb2FkIG9yIHJlYWR5c3RhdGVjaGFuZ2UgZG9lc24ndCBmaXJlIGluOlxyXG4gICAgICAgICAgICAgICAgIC0gaU9TIDwgNiAgICAgICAoZGVmYXVsdCBtb2JpbGUgYnJvd3NlcilcclxuICAgICAgICAgICAgICAgICAtIEFuZHJvaWQgPCA0LjQgKGRlZmF1bHQgbW9iaWxlIGJyb3dzZXIpXHJcbiAgICAgICAgICAgICAgICAgLSBTYWZhcmkgPCA2ICAgIChkZXNrdG9wIGJyb3dzZXIpXHJcbiAgICAgICAgICAgICAgICAgKi9cclxuICAgICAgICAgICAgICAgIGlmKHR5cGUgPT0gJ2NzcycpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZighdWFDc3NDaGVja2VkKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1YSA9ICR3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpO1xyXG5cclxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gaU9TIDwgNlxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZigvaVAoaG9uZXxvZHxhZCkvLnRlc3QoJHdpbmRvdy5uYXZpZ2F0b3IucGxhdGZvcm0pKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9ICgkd2luZG93Lm5hdmlnYXRvci5hcHBWZXJzaW9uKS5tYXRjaCgvT1MgKFxcZCspXyhcXGQrKV8/KFxcZCspPy8pO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGlPU1ZlcnNpb24gPSBwYXJzZUZsb2F0KFtwYXJzZUludCh2WzFdLCAxMCksIHBhcnNlSW50KHZbMl0sIDEwKSwgcGFyc2VJbnQodlszXSB8fCAwLCAxMCldLmpvaW4oJy4nKSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VDc3NMb2FkUGF0Y2ggPSBpT1NWZXJzaW9uIDwgNjtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmKHVhLmluZGV4T2YoXCJhbmRyb2lkXCIpID4gLTEpIHsgLy8gQW5kcm9pZCA8IDQuNFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFuZHJvaWRWZXJzaW9uID0gcGFyc2VGbG9hdCh1YS5zbGljZSh1YS5pbmRleE9mKFwiYW5kcm9pZFwiKSArIDgpKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNzc0xvYWRQYXRjaCA9IGFuZHJvaWRWZXJzaW9uIDwgNC40O1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYodWEuaW5kZXhPZignc2FmYXJpJykgPiAtMSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHZlcnNpb25NYXRjaCA9IHVhLm1hdGNoKC92ZXJzaW9uXFwvKFtcXC5cXGRdKykvaSk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VDc3NMb2FkUGF0Y2ggPSAodmVyc2lvbk1hdGNoICYmIHZlcnNpb25NYXRjaFsxXSAmJiBwYXJzZUZsb2F0KHZlcnNpb25NYXRjaFsxXSkgPCA2KTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgICAgICAgICAgaWYodXNlQ3NzTG9hZFBhdGNoKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0cmllcyA9IDEwMDA7IC8vICogMjAgPSAyMDAwMCBtaWxpc2Vjb25kc1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgaW50ZXJ2YWwgPSAkaW50ZXJ2YWwoKCkgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbC5zaGVldC5jc3NSdWxlcztcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaW50ZXJ2YWwuY2FuY2VsKGludGVydmFsKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbC5vbmxvYWQoKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goZSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKC0tdHJpZXMgPD0gMCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbC5vbmVycm9yKCk7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCAyMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xyXG4gICAgICAgICAgICB9O1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuICRkZWxlZ2F0ZTtcclxuICAgICAgICB9KVxyXG4gICAgfSk7XHJcblxyXG59KShhbmd1bGFyKTtcclxuIl19</pre></td></tr>
</table></pre>

</div>
<div class="footer">
    <div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Jul 24 2015 00:12:54 GMT+0200 (Paris, Madrid (heure d’été))</div>
</div>

<script src="../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>

<script src="../sorter.js"></script>
</body>
</html>
